#include <bits/stdc++.h>

#include <atcoder/all>
#define LL long long
using namespace std;
using namespace atcoder;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;

  cin >> n >> m;
  vector<modint998244353> A(n), B(m);
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    A[i] = t;
  }
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    B[i] = t;
  }

  vector<modint998244353> C = convolution(A, B);
  for (int i = 0; i < C.size(); i++) {
    cout << C[i].val() << " ";
  }
  return 0;
}
